<template>
    <div id="deviceList">
        <div>
            <table class="table-normal">
                <thead>
                    <tr>
                        <template v-if="isClick">
                            <th class="th-width-1">设备号</th>
                        </template>
                        <template v-else>
                            <th class="th-width-1">设备类型</th>
                        </template>
                        <template v-if="isClick">
                            <th class="th-width-2">设备类型</th>
                        </template>
                        <template v-else>
                            <th class="th-width-2">型号规格</th>
                        </template>
                        <template v-if="isClick">
                            <th class="th-width-2">设备状态</th>
                        </template>
                        <template v-else>
                            <th class="th-width-2">检验费用</th>
                        </template>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="device in deviceList">
                        <td>
                            <template v-if="isClick">
                                <router-link :to="{ name: 'deviceDetails', params:{ deviceId: device.device_detail_id}}">
                                    <template v-if="device.device_detail_code">
                                        {{device.device_detail_code}}
                                    </template>
                                </router-link>
                            </template>
                            <template v-else>
                                    {{device.deviceTypeId.device_type_name}}
                            </template>
                        </td>
                        <td>
                            <template v-if="isClick">
                                {{device.device_type_name}}
                            </template>
                            <template v-else>
                                {{device.type_specification}}
                            </template>
                        </td>
                        <td>
                            <template v-if="isClick">
                                {{device.status_code}}
                            </template>
                            <template v-else>
                                <template v-if="device.device_charge">
                                    {{device.device_charge}} 
                                </template>
                                <template v-else>
                                    ——
                                </template>
                            </template>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</template>

<script>
    export default {
        // isClick：false为不可点击查看设备详情，true为可点击查看设备详情
        props: ["deviceList","isClick"]
    }
</script>

<style scoped>
    .th-width-1 {
        width: 40%;
    }
    .th-width-2 {
        width: 30%;
    }
    .font-blod {
        color: black;
        font-weight: bold;
    }
</style>